<template>
  <div class="amazon-products">
    <div class="page-header">
      <h2>亚马逊商品管理</h2>
      <div class="header-actions">
        <el-button type="primary" @click="syncAmazonProducts" :loading="syncing">
          <i class="el-icon-refresh"></i> 同步亚马逊数据
        </el-button>
        <el-button type="success" @click="exportData">
          <i class="el-icon-download"></i> 导出数据
        </el-button>
      </div>
    </div>
    
    <el-card shadow="hover" class="filter-card">
      <el-form :inline="true" :model="filterForm" class="filter-form">
        <el-form-item label="商品名称">
          <el-input v-model="filterForm.name" placeholder="商品名称" clearable></el-input>
        </el-form-item>
        <el-form-item label="ASIN">
          <el-input v-model="filterForm.asin" placeholder="ASIN" clearable></el-input>
        </el-form-item>
        <el-form-item label="SKU">
          <el-input v-model="filterForm.sku" placeholder="SKU" clearable></el-input>
        </el-form-item>
        <el-form-item label="库存状态">
          <el-select v-model="filterForm.stockStatus" placeholder="库存状态" clearable>
            <el-option label="充足" value="sufficient"></el-option>
            <el-option label="警告" value="warning"></el-option>
            <el-option label="紧急" value="critical"></el-option>
            <el-option label="缺货" value="outOfStock"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="handleFilter">查询</el-button>
          <el-button @click="resetFilter">重置</el-button>
        </el-form-item>
      </el-form>
    </el-card>
    
    <el-card shadow="hover" class="table-card">
      <div class="table-operations">
        <span class="total-count">共 {{ total }} 条记录</span>
        <el-select v-model="batchAction" placeholder="批量操作" size="small" style="width: 120px">
          <el-option label="批量关联SKU" value="linkSku"></el-option>
          <el-option label="批量导出" value="export"></el-option>
        </el-select>
        <el-button size="small" type="primary" :disabled="!selectedProducts.length" @click="handleBatchAction">
          执行
        </el-button>
      </div>
      
      <el-table
        :data="products"
        style="width: 100%"
        @selection-change="handleSelectionChange"
        v-loading="loading"
      >
        <el-table-column type="selection" width="55"></el-table-column>
        <el-table-column prop="image" label="图片" width="80">
          <template slot-scope="scope">
            <el-image 
              style="width: 50px; height: 50px" 
              :src="scope.row.image" 
              :preview-src-list="[scope.row.image]"
              fit="contain"
            ></el-image>
          </template>
        </el-table-column>
        <el-table-column prop="name" label="商品名称" min-width="200" show-overflow-tooltip></el-table-column>
        <el-table-column prop="asin" label="ASIN" width="120"></el-table-column>
        <el-table-column prop="sku" label="亚马逊SKU" width="120"></el-table-column>
        <el-table-column prop="price" label="售价" width="100">
          <template slot-scope="scope">
            {{ scope.row.currency }} {{ scope.row.price }}
          </template>
        </el-table-column>
        <el-table-column prop="amazonStock" label="亚马逊库存" width="120"></el-table-column>
        <el-table-column prop="localStock" label="本地库存" width="120"></el-table-column>
        <el-table-column prop="stockStatus" label="库存状态" width="100">
          <template slot-scope="scope">
            <el-tag :type="getStockStatusType(scope.row.stockStatus)">
              {{ getStockStatusText(scope.row.stockStatus) }}
            </el-tag>
          </template>
        </el-table-column>
        <el-table-column prop="linkedSkus" label="关联SKU数" width="100">
          <template slot-scope="scope">
            <el-button type="text" @click="viewLinkedSkus(scope.row)">
              {{ scope.row.linkedSkus }} 个
            </el-button>
          </template>
        </el-table-column>
        <el-table-column prop="lastSync" label="最后同步" width="170"></el-table-column>
        <el-table-column label="操作" width="200" fixed="right">
          <template slot-scope="scope">
            <el-button size="mini" type="primary" @click="linkSkus(scope.row)">关联SKU</el-button>
            <el-button size="mini" type="info" @click="viewDetail(scope.row)">详情</el-button>
          </template>
        </el-table-column>
      </el-table>
      
      <div class="pagination-container">
        <el-pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="currentPage"
          :page-sizes="[10, 20, 50, 100]"
          :page-size="pageSize"
          layout="total, sizes, prev, pager, next, jumper"
          :total="total">
        </el-pagination>
      </div>
    </el-card>
    
    <!-- 关联SKU对话框 -->
    <el-dialog 
      :visible.sync="skuDialogVisible" 
      width="70%" 
      :close-on-click-modal="false"
      custom-class="sku-link-dialog"
    >
      <div slot="title" class="dialog-title">
        <i class="el-icon-link"></i>
        <span>关联SKU</span>
      </div>

      <div class="dialog-content">
        <!-- 商品信息卡片 -->
        <el-card class="product-info-card" shadow="never">
          <div class="product-info">
            <el-image :src="currentProduct.image" fit="contain"></el-image>
            <div class="product-details">
              <h3>{{ currentProduct.name }}</h3>
              <div class="product-meta">
                <span class="meta-item">
                  <label>ASIN:</label>
                  {{ currentProduct.asin }}
                </span>
                <span class="meta-item">
                  <label>亚马逊SKU:</label>
                  {{ currentProduct.sku }}
                </span>
              </div>
            </div>
          </div>
        </el-card>

        <!-- 已关联SKU部分 -->
        <div class="section-header">
          <h4><i class="el-icon-link"></i> 已关联SKU</h4>
          <span class="section-count">共 {{ linkedSkuList.length }} 个</span>
        </div>

        <el-table 
          :data="linkedSkuList" 
          style="width: 100%" 
          size="small"
          :header-cell-style="{ background: '#f5f7fa' }"
        >
          <el-table-column prop="sku" label="SKU编码" width="120"></el-table-column>
          <el-table-column prop="name" label="SKU名称" min-width="180" show-overflow-tooltip></el-table-column>
          <el-table-column prop="category" label="分类" width="120"></el-table-column>
          <el-table-column label="需求数量" width="150">
            <template slot-scope="scope">
              <el-input-number 
                v-model="scope.row.quantity" 
                :min="1" 
                :max="100" 
                size="mini"
                controls-position="right"
              ></el-input-number>
            </template>
          </el-table-column>
          <el-table-column prop="stock" label="当前库存" width="100" align="center"></el-table-column>
          <el-table-column label="状态" width="100" align="center">
            <template slot-scope="scope">
              <el-tag 
                :type="scope.row.stock >= scope.row.quantity ? 'success' : 'danger'"
                size="mini"
              >
                {{ scope.row.stock >= scope.row.quantity ? '充足' : '不足' }}
              </el-tag>
            </template>
          </el-table-column>
          <el-table-column label="操作" width="120" align="center">
            <template slot-scope="scope">
              <el-button 
                type="danger" 
                size="mini" 
                icon="el-icon-delete"
                circle
                plain
                @click="removeLinkedSku(scope.$index)"
              ></el-button>
            </template>
          </el-table-column>
        </el-table>

        <!-- 添加SKU部分 -->
        <div class="section-header add-sku-header">
          <h4><i class="el-icon-plus"></i> 添加SKU</h4>
        </div>

        <div class="add-sku-form">
          <el-form :inline="true" size="small">
            <el-form-item label="SKU搜索">
              <el-select
                v-model="selectedSku"
                filterable
                remote
                reserve-keyword
                :remote-method="searchSkus"
                :loading="searchingSkus"
                @focus="handleSkuSelectFocus"
                placeholder="请输入SKU编码或名称搜索"
                style="width: 300px"
                popper-class="sku-select-dropdown"
              >
                <template v-if="!searchKeyword && recentSkus.length">
                  <div class="select-section-title">最近使用</div>
                  <el-option
                    v-for="item in recentSkus"
                    :key="'recent-' + item.sku"
                    :label="`${item.sku} - ${item.name}`"
                    :value="item.sku"
                  >
                    <div class="sku-option">
                      <span class="sku-code">{{ item.sku }}</span>
                      <span class="sku-name">{{ item.name }}</span>
                      <el-tag size="mini" type="info" class="sku-tag">最近</el-tag>
                    </div>
                  </el-option>
                </template>

                <template v-if="!searchKeyword && frequentSkus.length">
                  <div class="select-section-title">常用SKU</div>
                  <el-option
                    v-for="item in frequentSkus"
                    :key="'frequent-' + item.sku"
                    :label="`${item.sku} - ${item.name}`"
                    :value="item.sku"
                  >
                    <div class="sku-option">
                      <span class="sku-code">{{ item.sku }}</span>
                      <span class="sku-name">{{ item.name }}</span>
                      <el-tag size="mini" type="success" class="sku-tag">常用</el-tag>
                    </div>
                  </el-option>
                </template>

                <template v-if="searchKeyword">
                  <div class="select-section-title" v-if="skuOptions.length">搜索结果</div>
                  <el-option
                    v-for="item in skuOptions"
                    :key="'search-' + item.sku"
                    :label="`${item.sku} - ${item.name}`"
                    :value="item.sku"
                  >
                    <div class="sku-option">
                      <span class="sku-code">{{ item.sku }}</span>
                      <span class="sku-name">{{ item.name }}</span>
                      <span class="sku-stock" :class="getStockClass(item.stock)">
                        库存: {{ item.stock }}
                      </span>
                    </div>
                  </el-option>
                  <div v-if="!skuOptions.length && searchKeyword" class="no-data">
                    <i class="el-icon-search"></i>
                    <span>未找到匹配的SKU</span>
                  </div>
                </template>
              </el-select>
            </el-form-item>
            <el-form-item label="数量">
              <el-input-number 
                v-model="newSkuQuantity" 
                :min="1" 
                :max="100"
                controls-position="right"
              ></el-input-number>
            </el-form-item>
            <el-form-item>
              <el-button 
                type="primary" 
                icon="el-icon-plus"
                @click="addSku"
              >添加</el-button>
            </el-form-item>
          </el-form>
        </div>
      </div>

      <div slot="footer" class="dialog-footer">
        <el-button @click="skuDialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="saveLinkedSkus" :loading="saving">
          保 存
        </el-button>
      </div>
    </el-dialog>
    
    <!-- 查看关联SKU对话框 -->
    <el-dialog title="关联SKU详情" :visible.sync="viewSkuDialogVisible" width="70%">
      <div class="dialog-content">
        <div class="product-info">
          <el-image :src="currentProduct.image" style="width: 80px; height: 80px"></el-image>
          <div class="product-details">
            <h3>{{ currentProduct.name }}</h3>
            <p>ASIN: {{ currentProduct.asin }} | 亚马逊SKU: {{ currentProduct.sku }}</p>
          </div>
        </div>
        
        <el-divider content-position="left">关联SKU列表</el-divider>
        
        <el-table :data="linkedSkuList" style="width: 100%" size="small">
          <el-table-column prop="sku" label="SKU编码" width="120"></el-table-column>
          <el-table-column prop="name" label="SKU名称" min-width="180"></el-table-column>
          <el-table-column prop="category" label="分类" width="120"></el-table-column>
          <el-table-column prop="quantity" label="需求数量" width="100"></el-table-column>
          <el-table-column prop="stock" label="当前库存" width="100"></el-table-column>
          <el-table-column prop="status" label="状态" width="100">
            <template slot-scope="scope">
              <el-tag :type="scope.row.stock >= scope.row.quantity ? 'success' : 'danger'">
                {{ scope.row.stock >= scope.row.quantity ? '充足' : '不足' }}
              </el-tag>
            </template>
          </el-table-column>
          <el-table-column label="操作" width="120">
            <template slot-scope="scope">
              <el-button type="primary" size="mini" @click="viewSkuDetail(scope.row)">详情</el-button>
            </template>
          </el-table-column>
        </el-table>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="viewSkuDialogVisible = false">关闭</el-button>
        <el-button type="primary" @click="editLinkedSkus">编辑关联</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
export default {
  name: 'AmazonProductsView',
  data() {
    return {
      loading: false,
      syncing: false,
      filterForm: {
        name: '',
        asin: '',
        sku: '',
        stockStatus: ''
      },
      products: [
        {
          id: 1,
          name: '多功能厨房刀具套装 - 专业级不锈钢刀具 5件套',
          asin: 'B07X1KRPVS',
          sku: 'KS-5PC-PRO',
          image: 'https://m.media-amazon.com/images/I/71v0BQM2TYL._AC_SL1500_.jpg',
          currency: '$',
          price: 49.99,
          amazonStock: 120,
          localStock: 35,
          stockStatus: 'sufficient',
          linkedSkus: 5,
          lastSync: '2023-05-15 08:30:22'
        },
        {
          id: 2,
          name: '不锈钢保温杯 - 双层真空隔热 500ml',
          asin: 'B08CZVSGWK',
          sku: 'TM-SS-500',
          image: 'https://m.media-amazon.com/images/I/61eDXs37OQL._AC_SL1500_.jpg',
          currency: '$',
          price: 24.99,
          amazonStock: 85,
          localStock: 12,
          stockStatus: 'warning',
          linkedSkus: 3,
          lastSync: '2023-05-15 08:30:22'
        },
        {
          id: 3,
          name: '智能手环 - 健康监测防水运动手表',
          asin: 'B09DPLK7HZ',
          sku: 'SB-FIT-X1',
          image: 'https://m.media-amazon.com/images/I/61TzjMeU3mS._AC_SL1500_.jpg',
          currency: '$',
          price: 35.99,
          amazonStock: 65,
          localStock: 8,
          stockStatus: 'warning',
          linkedSkus: 4,
          lastSync: '2023-05-15 08:30:22'
        },
        {
          id: 4,
          name: '便携式蓝牙音箱 - 防水户外音响',
          asin: 'B07WCNPP9F',
          sku: 'BT-SPK-W1',
          image: 'https://m.media-amazon.com/images/I/71v0BQM2TYL._AC_SL1500_.jpg',
          currency: '$',
          price: 39.99,
          amazonStock: 42,
          localStock: 3,
          stockStatus: 'critical',
          linkedSkus: 6,
          lastSync: '2023-05-15 08:30:22'
        },
        {
          id: 5,
          name: '多功能笔记本电脑支架 - 可调节高度',
          asin: 'B08L7HHPFZ',
          sku: 'LT-STD-ADJ',
          image: 'https://m.media-amazon.com/images/I/71v0BQM2TYL._AC_SL1500_.jpg',
          currency: '$',
          price: 29.99,
          amazonStock: 58,
          localStock: 7,
          stockStatus: 'warning',
          linkedSkus: 2,
          lastSync: '2023-05-15 08:30:22'
        }
      ],
      total: 125,
      currentPage: 1,
      pageSize: 10,
      selectedProducts: [],
      batchAction: '',
      skuDialogVisible: false,
      viewSkuDialogVisible: false,
      currentProduct: {},
      linkedSkuList: [],
      selectedSku: '',
      newSkuQuantity: 1,
      skuOptions: [],
      searchingSkus: false,
      saving: false,
      searchKeyword: '',
      recentSkus: [],
      frequentSkus: [],
      allSkus: []
    }
  },
  created() {
    this.fetchProducts();
    this.fetchAllSkus();
  },
  methods: {
    fetchProducts() {
      this.loading = true;
      // 模拟API请求
      setTimeout(() => {
        this.loading = false;
      }, 1000);
    },
    handleFilter() {
      this.currentPage = 1;
      this.fetchProducts();
    },
    resetFilter() {
      this.filterForm = {
        name: '',
        asin: '',
        sku: '',
        stockStatus: ''
      };
      this.handleFilter();
    },
    handleSizeChange(val) {
      this.pageSize = val;
      this.fetchProducts();
    },
    handleCurrentChange(val) {
      this.currentPage = val;
      this.fetchProducts();
    },
    handleSelectionChange(val) {
      this.selectedProducts = val;
    },
    handleBatchAction() {
      if (!this.batchAction) {
        this.$message.warning('请选择批量操作类型');
        return;
      }
      
      if (this.batchAction === 'linkSku') {
        this.$message.info(`将为${this.selectedProducts.length}个商品批量关联SKU`);
      } else if (this.batchAction === 'export') {
        this.$message.success(`已开始导出${this.selectedProducts.length}个商品的数据`);
      }
    },
    syncAmazonProducts() {
      this.syncing = true;
      // 模拟同步过程
      setTimeout(() => {
        this.syncing = false;
        this.$message.success('亚马逊商品数据同步成功');
        this.fetchProducts();
      }, 2000);
    },
    exportData() {
      this.$message.success('数据导出成功');
    },
    getStockStatusType(status) {
      const types = {
        sufficient: 'success',
        warning: 'warning',
        critical: 'danger',
        outOfStock: 'info'
      };
      return types[status] || 'info';
    },
    getStockStatusText(status) {
      const texts = {
        sufficient: '充足',
        warning: '警告',
        critical: '紧急',
        outOfStock: '缺货'
      };
      return texts[status] || '未知';
    },
    linkSkus(row) {
      this.currentProduct = row;
      this.fetchLinkedSkus(row.id);
      this.skuDialogVisible = true;
    },
    viewLinkedSkus(row) {
      this.currentProduct = row;
      this.fetchLinkedSkus(row.id);
      this.viewSkuDialogVisible = true;
    },
    viewDetail(row) {
      this.$router.push(`/amazon-products/${row.id}`);
    },
    fetchLinkedSkus(productId) {
      // 模拟获取关联SKU数据
      setTimeout(() => {
        this.linkedSkuList = [
          {
            sku: 'COMP-CPU-I5',
            name: 'Intel i5 处理器',
            category: '电脑配件',
            quantity: 1,
            stock: 15
          },
          {
            sku: 'COMP-RAM-16G',
            name: '16GB DDR4 内存条',
            category: '电脑配件',
            quantity: 2,
            stock: 28
          },
          {
            sku: 'COMP-SSD-512',
            name: '512GB SSD固态硬盘',
            category: '电脑配件',
            quantity: 1,
            stock: 10
          },
          {
            sku: 'COMP-MB-Z590',
            name: 'Z590主板',
            category: '电脑配件',
            quantity: 1,
            stock: 5
          }
        ];
      }, 500);
    },
    fetchAllSkus() {
      // 模拟API调用
      setTimeout(() => {
        this.allSkus = Array.from({ length: 150 }, (_, index) => ({
          sku: `SKU-${String(index + 1).padStart(3, '0')}`,
          name: `测试商品${index + 1}`,
          stock: Math.floor(Math.random() * 100),
          frequency: Math.floor(Math.random() * 50) // 模拟使用频率
        }))
        
        // 设置常用SKU（取使用频率最高的10个）
        this.frequentSkus = [...this.allSkus]
          .sort((a, b) => b.frequency - a.frequency)
          .slice(0, 10)
        
        // 模拟最近使用的SKU（取最后5个）
        this.recentSkus = this.allSkus.slice(-5)
      }, 500)
    },
    handleSkuSelectFocus() {
      this.searchKeyword = ''
      this.skuOptions = []
    },
    searchSkus(query) {
      this.searchKeyword = query
      if (!query) {
        this.skuOptions = []
        return
      }

      this.searchingSkus = true
      // 模拟搜索延迟
      setTimeout(() => {
        const lowercaseQuery = query.toLowerCase()
        this.skuOptions = this.allSkus.filter(item => 
          item.sku.toLowerCase().includes(lowercaseQuery) || 
          item.name.toLowerCase().includes(lowercaseQuery)
        ).slice(0, 20) // 限制显示前20条结果
        this.searchingSkus = false
      }, 300)
    },
    getStockClass(stock) {
      if (stock <= 0) return 'stock-empty'
      if (stock < 10) return 'stock-low'
      return 'stock-sufficient'
    },
    addSku() {
      if (!this.selectedSku) {
        this.$message.warning('请选择要添加的SKU');
        return;
      }
      
      // 查找选中的SKU详情
      const selectedSkuInfo = this.skuOptions.find(item => item.sku === this.selectedSku);
      
      // 检查是否已经添加过
      const exists = this.linkedSkuList.some(item => item.sku === this.selectedSku);
      if (exists) {
        this.$message.warning('该SKU已添加');
        return;
      }
      
      // 添加到列表
      this.linkedSkuList.push({
        sku: selectedSkuInfo.sku,
        name: selectedSkuInfo.name,
        category: '未分类', // 假设默认分类
        quantity: this.newSkuQuantity,
        stock: Math.floor(Math.random() * 30) // 模拟随机库存
      });
      
      // 重置选择
      this.selectedSku = '';
      this.newSkuQuantity = 1;
      
      this.$message.success('SKU添加成功');
    },
    removeLinkedSku(index) {
      this.linkedSkuList.splice(index, 1);
    },
    saveLinkedSkus() {
      this.saving = true;
      // 模拟保存过程
      setTimeout(() => {
        this.$message.success('关联SKU保存成功');
        this.skuDialogVisible = false;
        // 更新商品的关联SKU数
        const index = this.products.findIndex(item => item.id === this.currentProduct.id);
        if (index !== -1) {
          this.products[index].linkedSkus = this.linkedSkuList.length;
        }
        this.saving = false;
      }, 500);
    },
    editLinkedSkus() {
      this.viewSkuDialogVisible = false;
      this.skuDialogVisible = true;
    },
    viewSkuDetail(sku) {
      this.$router.push(`/inventory/sku/${sku.sku}`);
    }
  }
}
</script>

<style lang="scss" scoped>
.amazon-products {
  padding: 20px;
}
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.page-header h2 {
  margin: 0;
  font-size: 22px;
  color: var(--text-primary);
}
.header-actions {
  display: flex;
  gap: 10px;
}
.filter-card {
  background-color: #fff;
  border-radius: 8px;
  margin-bottom: 20px;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.05);
}
.filter-form {
  display: flex;
  flex-wrap: wrap;
}
.table-card {
  margin-bottom: 20px;
}
.table-operations {
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.total-count {
  margin-right: auto;
  color: var(--text-secondary);
  font-size: 14px;
}
.pagination-container {
  margin-top: 15px;
  display: flex;
  justify-content: flex-end;
}
.product-info {
  display: flex;
  align-items: center;
  margin-bottom: 20px;
}
.product-details {
  margin-left: 15px;
}
.product-details h3 {
  margin: 0 0 5px 0;
  font-size: 16px;
}
.product-details p {
  margin: 0;
  color: #606266;
  font-size: 14px;
}
.product-info-card {
  margin-bottom: 20px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  
  .product-info {
    display: flex;
    align-items: center;
    
    .el-image {
      width: 80px;
      height: 80px;
      border-radius: 4px;
      margin-right: 15px;
    }
    
    .product-details {
      h3 {
        margin: 0 0 10px 0;
        font-size: 16px;
        color: var(--text-primary);
      }
      
      .product-meta {
        display: flex;
        gap: 20px;
        
        .meta-item {
          font-size: 14px;
          color: var(--text-secondary);
          
          label {
            margin-right: 5px;
            font-weight: bold;
          }
        }
      }
    }
  }
}
.section-header {
  display: flex;
  align-items: center;
  margin: 20px 0 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
  
  h4 {
    margin: 0;
    font-size: 16px;
    display: flex;
    align-items: center;
    
    i {
      margin-right: 5px;
      color: var(--primary-color);
    }
  }
  
  .section-count {
    margin-left: 10px;
    font-size: 14px;
    color: var(--text-secondary);
  }
}
.add-sku-header {
  margin-top: 30px;
}
.add-sku-form {
  background-color: #f5f7fa;
  padding: 15px;
  border-radius: 8px;
}
.sku-option {
  display: flex;
  align-items: center;
  padding: 5px 0;
  
  .sku-code {
    font-weight: bold;
    margin-right: 10px;
    color: var(--primary-color);
    width: 100px;
  }
  
  .sku-name {
    flex: 1;
    color: var(--text-secondary);
  }

  .sku-stock {
    margin-left: 10px;
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 4px;

    &.stock-sufficient {
      color: var(--success-color);
      background-color: rgba(0, 194, 168, 0.1);
    }

    &.stock-low {
      color: var(--warning-color);
      background-color: rgba(255, 159, 46, 0.1);
    }

    &.stock-empty {
      color: var(--danger-color);
      background-color: rgba(255, 71, 87, 0.1);
    }
  }

  .sku-tag {
    margin-left: 10px;
  }
}
.dialog-title {
  display: flex;
  align-items: center;
  font-size: 18px;
  font-weight: bold;
  
  i {
    margin-right: 8px;
    color: var(--primary-color);
  }
}
.dialog-footer {
  display: flex;
  justify-content: flex-end;
  padding: 10px;
}
.el-input-number.el-input-number--mini {
  width: 100px;
}
.el-button.is-circle {
  padding: 7px;
}
.select-section-title {
  padding: 8px 10px;
  font-size: 12px;
  color: var(--text-secondary);
  background-color: #f5f7fa;
}
.no-data {
  padding: 20px;
  text-align: center;
  color: var(--text-secondary);
  
  i {
    font-size: 20px;
    margin-right: 5px;
  }
}
</style>

<style>
/* 全局样式 */
.sku-select-dropdown {
  .el-select-dropdown__item {
    height: auto;
    padding: 5px 15px;
  }
}
</style> 